/**
 * api接口统一管理
 */
import {get, post} from './http'

const api = {};

//根据父code查询字典
api.dictionaryByCode = p => post('/api/dictionary/findByCode', p);

//根据父code保存字典
api.dictionarySave = p => post('/api/dictionary/save', p)

//批量删除字典
api.dictionaryRemoveByIds = p => post('/api/dictionary/removeByIds', p);

//登录
api.login = p => post('/api/user/login', p);

//申请校区
api.register = p => post('/api/campus/add', p);

//修改密码
api.changePwd = p => post('/api/user/change_pwd', p)

api.userPageList = p => post('/api/user/searchPage', p);

api.userRolePageList = p => post('/api/user/get_list', p);

//根据id获取用户及角色
api.userRoleById = p => post('/api/user/roleById', p);

api.getRoleByCode = p => post('/api/role/getByCode', p);

//用户查询，不分页
api.userGetAll = p => post('/api/user/get_all', p);

//保存或修改用户
api.userSave = p => post('/api/user/save', p);

//保存排课
api.teachingSave = p => post('/api/teaching/save', p);

//删除
api.teachingRemove = p => post('/api/teaching/deleteById', p);

//根据天获取排课
api.teachingGetByDay = p => post('/api/teaching/arrangeByDay', p);

//搜索排课(根据teachId)
api.teachingSearch = p => post('/api/teaching/search', p);

//设置和上个礼拜相同
api.teachingSetSomeProWeek = p => post('/api/teaching/setSomeProWeek', p);

//设置和某天相同
api.teachingSetSamePre = p => post('/api/teaching/set_same_pre', p);

//批量修改课程状态
api.courseChangeStatusByIds = p => post('/api/course/changeStatusByIds', p);

api.userDelete = p => post("/api/user/delete/", p);

//清空报名数据
api.curriculaDeleteAll = p => get('/api/curricula/delete_all', p);

//获取日记本记录
api.ticklerList = p => post('/api/tickler/get_list', p);

//月份查询
api.monthRecord = p => post('/api/month/search', p);

//课消下载（月份）
// api.recordMonthDownload = p => get('/api/download_by_month/' + p, null);

//保存用户
export const userSave = p => post('/api/user/save', p);

//获取排课
export const teachingQuery = p => post('/api/teaching/query', p);


//保存排课
export const saveTeaching = p => post('/api/teaching/save', p);

//删除排课
export const teachingRemoveByIds = p => post('/api/teaching/removeByIds', p);

//根据时间段获取课程
export const teachingListByTime = p => post('/api/teaching/getByTime', p);

//获取打卡记录
export const getRecord = p => post('/api/record/getRecord', p);

//单个打卡
export const clockRecord = p => post('/api/record/clock', p);

//重置打卡
export const reset = p => get('/api/record/reset/' + p, null);

//获取季度
export const quarterGetAll = p => get('/api/quarter/getAll', p);

//添加季度
export const quarterAdd = p => post('/api/quarter/add', p);

//删除季度
export const quarterDelete = p => post('/api/quarter/delete', p);

//设置默认
export const quarterSetDefault = p => post('/api/quarter/change/status', p);

//根据时间获取课程
export const getCourseByDay = p => post("/api/course/getCourseByDay", p);

export const getStatistics = p => post('/api/record/statistics', p);

export const getStatisticsByDay = p => post('/api/record/statisticsByDay', p);

//根据时间和teachingId获取备注
export const getTeachingRemark = p => post('/api/teaching/manage/search', p);

//修改或添加课程备注
export const saveTeachingRemark = p => post('/api/teaching/manage/save', p);

//删除课程备注
export const deleteTeachingRemark = p => post('/api/teaching/manage/delete', p);

//获取所有角色
api.getRoles = p => post('/api/role/get_all', p);

//保存或修改用户及角色信息
api.saveUser = p => post('/api/user/save', p);

//获取学生列表(根据学生报名获取)
api.curriculaList = p => post('/api/curricula/search', p)

//获取报名列表
api.curriculaGetList = p => post('/api/curricula/get_list', p)

//保存报名信息
api.curriculaSave = p => post('/api/curricula/save', p)

//修改状态
api.curriculaUpdateStatus = p => post('/api/curricula/update_status', p)

//月份记录
api.monthList = p => get('/api/month/get_by_curricula/' + p, null);

//保存记录
api.monthSave = p => post('/api/month/save/', p);

//删除
api.monthDelete = p => post('/api/month/delete', p);

//根据日期获得上课时间段列表
api.teachingTimeList = p => post('/api/teaching/getTimeList', p);

//根据条件获取课程
api.teachingSearch = p => post('/api/teaching/search', p);

//获取记录
api.recordByTeachingId = p => post('/api/record/getByTeachingId', p);

//保存考勤记录
api.recordSave = p => post('/api/record/save', p);

//审核
api.recordVerify = p => post('/api/record/verify', p)

//批量审核
api.recordVerifyBatch = p => post('/api/record/verify_batch', p)

//按天审核
api.recordVerifyByDay = p => post('/api/record/verify_by_day', p)

export default api;

